package laba2;

/**
 *
 * @author yakimovich
 */
public class Test {

    /**
     *
     * @param args
     */
    public static void main(String[] args) {
        FractionNumberOperationImpl fNO = new FractionNumberOperationImpl();


        FractionNumberImpl n1 = new FractionNumberImpl(1, 2);
        FractionNumberImpl n2 = new FractionNumberImpl(1, 3);

        System.out.println("n1: (" + n1.getDividend() + "; " + n1.getDivisor() + ")");
        System.out.println("n2: (" + n2.getDividend() + "; " + n2.getDivisor() + ")");
        System.out.println();

        System.out.println("n1 + n2: " + fNO.add(n1, n2).value());
        System.out.println("n1 - n2: " + fNO.sub(n1, n2).value());
        System.out.println("n1 * n2: " + fNO.mul(n1, n2).value());
        System.out.println("n1 / n2: " + fNO.div(n1, n2).value());

        System.out.println("*****************************");
        n2 = new FractionNumberImpl(0, 1);

        System.out.println("n1: (" + n1.getDividend() + "; " + n1.getDivisor() + ")");
        System.out.println("n2: (" + n2.getDividend() + "; " + n2.getDivisor() + ")");
        try {
            System.out.println("n1 / n2: " + fNO.div(n1, n2).value());
        } catch (ArithmeticException e) {
            System.out.println(e);
        }
    }
}